<template>
	<div style="background-color: #000;min-height: 100vh;color: #fff;">
		<div style="position: relative;height:4em;overflow: hidden;">
			<div style="position:absolute;top: 0;left: 0;right: 0;height: 7em;background-color: #fff;opacity: 0.5;"></div>
			<div style="position: absolute;left: 1.0em;top: 0px;"><image :src="imgHttp + '/test/bg/logo.png'" style="height: 4em;width: 7em;"></image></div>
		</div>
		<div @click="toIndex" style="display: flex;justify-items: center;margin: 0.5em;">
			<div><image :src="imgHttp + '/test/back.png'" style="width: 1.5em;height:1.5em;"></image></div>
			<div style="font-size: 1em;">返回首页</div>
		</div>
		<div style="text-align: center;font-size: 1.5em;margin-bottom: 1.0em;margin-top: 1.2em;">加盟店申请</div>
		<div class="row" style="margin-top: 0;">
			<div class="inputlable">经销商名称</div>
			<div class="inputright">
				<input type="text" v-model="obj.leName" placeholder="请输入经销商名称" class="inputText"/>
		    </div>
			<div class="clear"></div>
		</div>
		<div class="row">
			<div class="inputlable">用户名</div>
			<div class="inputright">
				<input type="text" v-model="obj.leUsername" placeholder="请输入用户名" class="inputText"/>
			</div>
			<div class="clear"></div>
		</div>
		<div class="row">
			<div class="inputlable">密码</div>
			<div class="inputright">
				<input type="text" v-model="obj.lePassword" placeholder="请输入密码" class="inputText"/>
			</div>
			<div class="clear"></div>
		</div>
		<div class="row">
			<div class="inputlable">手机号</div>
			<div class="inputright">
				<input type="text" v-model="obj.leNumber" placeholder="请输入手机号" class="inputText"/>
			</div>
			<div class="clear"></div>
		</div>
		<div class="row">
			<div class="inputlable">地址</div>
			<div class="inputright">
				<input type="text" v-model="obj.lesite" placeholder="请输入地址" class="inputText"/>
			</div>
			<div class="clear"></div>
		</div>
		<div class="row">
			<div class="inputlable">详细地址</div>
			<div class="inputright">				
				<textarea v-model="obj.leLocation"  class="inputText" style="height: 5em;" placeholder="请输入详细地址"></textarea>
			</div>
			<div class="clear"></div>
		</div>
		<div style="margin-top: 0.8em;">
			<button style="width: 90%;margin: 0 auto;height: 2.0em;line-height: 1.8em;font-size: 1.0em;border:1px solid red;background-color: #000;color: #fff;" @click="addData">提交申请</button>
		</div>
	</div>
</template>

<script>
	import api from '@/common/httprequest.js'
	export default {		
		data() {
			return {
				imgHttp: api.getImgUrl(),
				obj:{
					leName:null,
					leUsername:null,
					lePassword:null,
					leNumber:null,
					lesite:null,
					leLocation:null
				}
			}
		},
		onLoad() {
			
		},
		mounted() {
			
		},
		methods: {
			toIndex(){
				uni.switchTab({
					url: '../index/index'
				})
			},
			addData(){
				if(this.obj.leNumber == null){
					uni.showToast({
						icon:'error',
						duration:1000,
						title:'手机号不能为空！'
					})
					return;
				}
				uni.showLoading({
					title: '数据处理中...'
				});
				api.request({
					method: "post",
					url: "/applet/league",
					params:this.obj,
				}).then(res => {	
					uni.hideLoading();
					//alert(JSON.stringify(res));
				
					if (res.code == 200) {
						uni.showToast({
							title: '加盟店申请成功！',
							icon: 'none',
							duration: 2000
						})
						uni.redirectTo({
							url: '/pages/jmd/index'
						})
						return;
					}
				});	
			}
		}
	}
</script>

<style>
	.inputright{
		float: left;
		margin-left: 0.5em;
		width:calc(100% - 10em);
	}
	.inputlable{
		float: left;
		min-width: 6em;
		/*background-color: #F5F5F5;*/
		text-align: right;
	}
	.row{
		text-align: center;
		font-size: 1.0em;
		margin-top: 0.3em;
		overflow: hidden;
	}
	.inputText{
		text-align: left;
		height: 2.0em;
		line-height: 2.0em;
		border: 1px solid #FF0000;
		font-size: 0.8em;
		padding-left: 0.5em;
		padding-right: 0.5em;
		width: 100%;
	}
	.clear{
		clear: both;
	}
</style>
